// require.ensure 是 Webpack 的特殊语法，用来设置 code-split point
import App from '../App.vue'
// import Home from '../views/index.vue'
import GoodsClassify from '../views/goods/classify.vue'
import VideoList from '../views/video/list.vue'
import CartList from '../views/cart/list.vue'
import My from '../views/my.vue'
// const Home = r => require.ensure([], () => r(require('../views/index.vue')), 'pages/home')
const GoodsDetail = r => require.ensure([], () => r(require('../views/goods/detail.vue')), 'pages/goods/detail')
const AddressList = r => require.ensure([], () => r(require('../views/address/list.vue')), 'pages/address/list')
const ShopAddressList = r => require.ensure([], () => r(require('../views/address/shop.vue')), 'pages/address/shop')
const AddressAdd = r => require.ensure([], () => r(require('../views/address/add.vue')), 'pages/address/add')
const AddressEdit = r => require.ensure([], () => r(require('../views/address/edit.vue')), 'pages/address/edit')
const OrderConfirm = r => require.ensure([], () => r(require('../views/order/confirm.vue')), 'pages/order/confirm')
const OrderList = r => require.ensure([], () => r(require('../views/order/list.vue')), 'pages/order/list')
const OrderFriend = r => require.ensure([], () => r(require('../views/order/friend.vue')), 'pages/order/friend')
const OrderDetail = r => require.ensure([], () => r(require('../views/order/detail.vue')), 'pages/order/detail')
const OrderExpress = r => require.ensure([], () => r(require('../views/order/express.vue')), 'pages/order/express')
const OrderAgent = r => require.ensure([], () => r(require('../views/order/agent.vue')), 'pages/order/agent')
const OrderSuccess = r => require.ensure([], () => r(require('../views/order/success.vue')), 'pages/order/success')
const OrderError = r => require.ensure([], () => r(require('../views/order/error.vue')), 'pages/order/error')
const MemberSpread = r => require.ensure([], () => r(require('../views/member/spread.vue')), 'pages/member/spread')
const MemberRegister = r => require.ensure([], () => r(require('../views/member/register.vue')), 'pages/member/register')
const NoticeList = r => require.ensure([], () => r(require('../views/notice/list.vue')), 'pages/notice/list')
const NoticeDetail = r => require.ensure([], () => r(require('../views/notice/detail.vue')), 'pages/notice/detail')
const MemberNoticeList = r => require.ensure([], () => r(require('../views/member/notice/list.vue')), 'pages/member/notice/list')
const MemberNoticeDetail = r => require.ensure([], () => r(require('../views/member/notice/detail.vue')), 'pages/member/notice/detail')
const CommentAdd = r => require.ensure([], () => r(require('../views/comment/add.vue')), 'pages/comment/add')
const VideoDetail = r => require.ensure([], () => r(require('../views/video/detail.vue')), 'pages/video/detail')
const CommentList = r => require.ensure([], () => r(require('../views/comment/list.vue')), 'pages/comment/list')
const RefundList = r => require.ensure([], () => r(require('../views/refund/list.vue')), 'pages/refund/list')
const RefundGoodsAdd = r => require.ensure([], () => r(require('../views/refund/goods/add.vue')), 'pages/refund/goods/add')
const RefundGoodsList = r => require.ensure([], () => r(require('../views/refund/goods/list.vue')), 'pages/refund/goods/list')
const RefundGoodsDetail = r => require.ensure([], () => r(require('../views/refund/goods/detail.vue')), 'pages/refund/goods/detail')
const RefundGoodsExpressAdd = r => require.ensure([], () => r(require('../views/refund/goods/express/add.vue')), 'pages/refund/goods/express/add')
const RefundGoodsExpressDetail = r => require.ensure([], () => r(require('../views/refund/goods/express/detail.vue')), 'pages/refund/goods/express/detail')
const RefundMoneyAdd = r => require.ensure([], () => r(require('../views/refund/money/add.vue')), 'pages/refund/money/add')
const RefundMoneyDetail = r => require.ensure([], () => r(require('../views/refund/money/detail.vue')), 'pages/refund/money/detail')
const SettingIndex = r => require.ensure([], () => r(require('../views/setting/index.vue')), 'pages/setting/index')
const Password = r => require.ensure([], () => r(require('../views/setting/password.vue')), 'pages/setting/password')
const Name = r => require.ensure([], () => r(require('../views/setting/name.vue')), 'pages/setting/name')
const TrueName = r => require.ensure([], () => r(require('../views/setting/truename.vue')), 'pages/setting/truename')
const NewsList = r => require.ensure([], () => r(require('../views/news/list.vue')), 'pages/news/list')
const NewsDetail = r => require.ensure([], () => r(require('../views/news/detail.vue')), 'pages/news/detail')
const Iframe = r => require.ensure([], () => r(require('../views/iframe.vue')), 'pages/iframe')
const BalconyList = r => require.ensure([], () => r(require('../views/balcony/list.vue')), 'pages/balcony/list')
const ActiveList = r => require.ensure([], () => r(require('../views/active/list.vue')), 'pages/active/list')
const ActiveGoodsList = r => require.ensure([], () => r(require('../views/active/goodsList.vue')), 'pages/active/goodsList')
const CollectList = r => require.ensure([], () => r(require('../views/collect/list.vue')), 'pages/collect/list')
const SearchGoods = r => require.ensure([], () => r(require('../views/search/goods.vue')), 'pages/search/goods')
const SearchFriend = r => require.ensure([], () => r(require('../views/search/friend.vue')), 'pages/search/friend')
const SearchIntegral = r => require.ensure([], () => r(require('../views/search/integral.vue')), 'pages/search/integral')
const InvitedMember = r => require.ensure([], () => r(require('../views/invited/member.vue')), 'pages/invited/member')
const InvitedOrder = r => require.ensure([], () => r(require('../views/invited/order.vue')), 'pages/invited/order')
const LoginPassword = r => require.ensure([], () => r(require('../views/login/password.vue')), 'pages/login/password')
const LoginMessage = r => require.ensure([], () => r(require('../views/login/message.vue')), 'pages/login/message')
const LoginBind = r => require.ensure([], () => r(require('../views/login/bind.vue')), 'pages/login/bind')

const AccountIndex = r => require.ensure([], () => r(require('../views/account/index.vue')), 'pages/account/index')
const AccountReport = r => require.ensure([], () => r(require('../views/account/report.vue')), 'pages/account/report')
const BalanceCharge = r => require.ensure([], () => r(require('../views/account/balance/charge.vue')), 'pages/account/balance/charge')
const BalanceBill = r => require.ensure([], () => r(require('../views/account/balance/bill.vue')), 'pages/account/balance/bill')
const BalanceHistory = r => require.ensure([], () => r(require('../views/account/balance/history.vue')), 'pages/account/balance/history')
const BalanceSuccess = r => require.ensure([], () => r(require('../views/account/balance/success.vue')), 'pages/account/balance/success')
const BalanceError = r => require.ensure([], () => r(require('../views/account/balance/error.vue')), 'pages/account/balance/error')
const IntegralIncome = r => require.ensure([], () => r(require('../views/account/integral/income.vue')), 'pages/account/integral/income')
const IntegralOther = r => require.ensure([], () => r(require('../views/account/integral/other.vue')), 'pages/account/integral/other')
const IntegralHistory = r => require.ensure([], () => r(require('../views/account/integral/history.vue')), 'pages/account/integral/history')
const IntegralInstruction = r => require.ensure([], () => r(require('../views/account/integral/instruction.vue')), 'pages/account/integral/instruction')
const AccountWithdraw = r => require.ensure([], () => r(require('../views/account/withdraw.vue')), 'pages/account/withdraw')
const IntegralTransfer = r => require.ensure([], () => r(require('../views/account/integral/transfer.vue')), 'pages/account/integral/transfer')
const MemberFriend = r => require.ensure([], () => r(require('../views/member/friend.vue')), 'pages/member/friend')
const BankcardEdit = r => require.ensure([], () => r(require('../views/bankcard/edit.vue')), 'pages/bankcard/edit')
const BankcardList = r => require.ensure([], () => r(require('../views/bankcard/list.vue')), 'pages/bankcard/list')
const PayResultConfirm = r => require.ensure([], () => r(require('../views/order/payResultConfirm.vue')), 'pages/order/payResultConfirm')
const QrcodePay = r => require.ensure([], () => r(require('../views/account/qrcodePay.vue')), 'pages/account/qrcodePay')
const WalletBind = r => require.ensure([], () => r(require('../views/wallet/bind.vue')), 'pages/wallet/bind')
const WalletTransfer = r => require.ensure([], () => r(require('../views/wallet/transfer.vue')), 'pages/wallet/transfer')
const WalletSuccess = r => require.ensure([], () => r(require('../views/wallet/success.vue')), 'pages/wallet/success')
const Gzh = r => require.ensure([], () => r(require('../views/setting/gzh.vue')), 'pages/setting/gzh')
const GzhHelp = r => require.ensure([], () => r(require('../views/setting/gzh-help.vue')), 'pages/setting/gzh-help')
const Fwh = r => require.ensure([], () => r(require('../views/setting/fwh.vue')), 'pages/setting/fwh')
const About = r => require.ensure([], () => r(require('../views/setting/about.vue')), 'pages/setting/about')
const Download = r => require.ensure([], () => r(require('../views/setting/download.vue')), 'pages/setting/download')
const NoticeAlert = r => require.ensure([], () => r(require('../views/notice/alert.vue')), 'pages/notice/alert')
const MemberTobeVip = r => require.ensure([], () => r(require('../views/member/tobeVip.vue')), 'pages/member/tobeVip')
const MemberFlowerCoinBill = r => require.ensure([], () => r(require('../views/member/flowerCoinBill.vue')), 'pages/member/flowerCoinBill')
const MemberIdentifyAdd = r => require.ensure([], () => r(require('../views/member/identifyAdd.vue')), 'pages/member/identifyAdd')
const MemberIdentifyInfo = r => require.ensure([], () => r(require('../views/member/identifyInfo.vue')), 'pages/member/identifyInfo')
const MemberInfo = r => require.ensure([], () => r(require('../views/member/info.vue')), 'pages/member/info')
const Transfer = r => require.ensure([], () => r(require('../views/account/transfer.vue')), 'pages/account/transfer')
const SetName = r => require.ensure([], () => r(require('../views/setting/setName.vue')), 'pages/setting/setName')
const OrderAddress = r => require.ensure([], () => r(require('../views/address/orderAddress.vue')), 'pages/address/orderAddress')
const NextSum = r => require.ensure([], () => r(require('../views/member/nextSum.vue')), 'pages/member/nextSum')
const Transaction = r => require.ensure([], () => r(require('../views/transfer/transaction.vue')), 'pages/transfer/transaction')
const TransactionDetail = r => require.ensure([], () => r(require('../views/transfer/transactionDetail.vue')), 'pages/transfer/transactionDetail')
const TransactionSeller = r => require.ensure([], () => r(require('../views/transfer/transactionSeller.vue')), 'pages/transfer/transactionSeller')
const AccountReward = r => require.ensure([], () => r(require('../views/account/reward.vue')), 'pages/account/reward')
const SettingBankCard = r => require.ensure([], () => r(require('../views/setting/bankCard.vue')), 'pages/setting/bankCard')
const ListGoods = r => require.ensure([], () => r(require('../views/goods/listGoods.vue')), 'pages/goods/listGoods')
const Categories = r => require.ensure([], () => r(require('../views/category/categories.vue')), 'pages/category/categories')
const ListGoods2 = r => require.ensure([], () => r(require('../views/goods/listGoods2.vue')), 'pages/goods/listGoods2')

const scrollBehavior = (to, from, savedPosition) => {
  return {x: 0, y: 0}
}
let list = [
  // {
  //   path: '*',
  //   name: 'default',
  //   component: Home,
  //   meta: {
  //     login: true
  //   }
  // },
  {
    path: '/',
    name: 'app',
    component: App, // 顶级路由
    children: [ // 二级路由
      {
        path: '/home',
        name: 'home',
        component: GoodsClassify,
        meta: {
          // keepAlive: true,
          login: true
        }
      },
      {
        path: '/',
        name: 'my',
        component: My,
        meta: {
          // keepAlive: true,
          login: true
        }
      },
      {
        path: '/goods/classify',
        name: 'goods-classify',
        component: GoodsClassify,
        meta: {
          keepAlive: false,
          login: false
        }
      },
      {
        path: '/video/list',
        name: 'video-list',
        component: VideoList,
        meta: {
          login: true
        }
      },
      {
        path: '/cart/list',
        name: 'cart-list',
        component: CartList,
        meta: {
          login: false
        }
      },
      {
        path: '/my',
        name: 'my',
        component: My,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/goods/detail/:id',
        name: 'goods-detail',
        component: GoodsDetail,
        meta: {
          login: false
        }
      },
      {
        path: '/address/list',
        name: 'address-list',
        component: AddressList,
        meta: {
          login: true
        }
      },
      {
        path: '/address/shop',
        name: 'address-shop',
        component: ShopAddressList,
        meta: {
          login: false
        }
      },
      {
        path: '/address/add',
        name: 'address-add',
        component: AddressAdd,
        meta: {
          login: true
        }
      },
      {
        path: '/address/edit/:id',
        name: 'address-edit',
        component: AddressEdit,
        meta: {
          login: true
        }
      },
      {
        path: '/order/confirm',
        name: 'order-confirm',
        component: OrderConfirm,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/list',
        name: 'order-list',
        component: OrderList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/friend',
        name: 'order-friend',
        component: OrderFriend,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/detail/:id',
        name: 'order-detail',
        component: OrderDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/express/:id',
        name: 'order-express',
        component: OrderExpress,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/agent',
        name: 'order-agent',
        component: OrderAgent,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/error',
        name: 'order-error',
        component: OrderError,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/success',
        name: 'order-success',
        component: OrderSuccess,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/member/spread',
        name: 'member-spread',
        component: MemberSpread,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/member/register',
        name: 'member-register',
        component: MemberRegister,
        meta: {
          login: true
        }
      },
      {
        path: '/video/detail/:id',
        name: 'video-detail',
        component: VideoDetail,
        meta: {
          login: true
        }
      },
      {
        path: '/notice/list',
        name: 'notice-list',
        component: NoticeList,
        meta: {
          login: true
        }
      },
      {
        path: '/notice/detail/:id',
        name: 'notice-detail',
        component: NoticeDetail,
        meta: {
          login: true
        }
      },
      {
        path: '/member/notice/list',
        name: 'member-notice-list',
        component: MemberNoticeList,
        meta: {
          login: true
        }
      },
      {
        path: '/member/notice/detail/:id',
        name: 'member-notice-detail',
        component: MemberNoticeDetail,
        meta: {
          login: true
        }
      },
      {
        path: '/comment/add/:id',
        name: 'comment-add',
        component: CommentAdd,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/comment/list/:id',
        name: 'comment-list',
        component: CommentList,
        meta: {
          login: true
        }
      },
      {
        path: '/refund/list',
        name: 'refund-list',
        component: RefundList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/detail/:id',
        name: 'refund-goods-detail',
        component: RefundGoodsDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/list/:orderId/:goodsId',
        name: 'refund-goods-list',
        component: RefundGoodsList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/add/:orderId/:goodsId',
        name: 'refund-goods-add',
        component: RefundGoodsAdd,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/express/add',
        name: 'refund-goods-express-add',
        component: RefundGoodsExpressAdd,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/express/detail/:id',
        name: 'refund-goods-express-detail',
        component: RefundGoodsExpressDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/money/add/:orderId/:goodsId',
        name: 'refund-money-add',
        component: RefundMoneyAdd,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/money/detail/:id',
        name: 'refund-money-detail',
        component: RefundMoneyDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/setting/index',
        name: 'setting-index',
        component: SettingIndex,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/setting/password',
        name: 'setting-password',
        component: Password,
        meta: {
          login: false,
          auth: false
        }
      },
      {
        path: '/setting/name',
        name: 'setting-name',
        component: Name,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/setting/truename',
        name: 'setting-truename',
        component: TrueName,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/news/list',
        name: 'news-list',
        component: NewsList,
        meta: {
          login: false
        }
      },
      {
        path: '/news/detail/:id',
        name: 'news-detail',
        component: NewsDetail,
        meta: {
          login: false
        }
      },
      {
        path: '/iframe',
        name: 'iframe',
        component: Iframe,
        meta: {
          login: true
        }
      },
      {
        path: 'active/list',
        name: 'active-list',
        component: ActiveList,
        meta: {
          login: true
        }
      },
      {
        path: 'active/goodsList/:id',
        name: 'active-goods-list',
        component: ActiveGoodsList,
        meta: {
          login: true
        }
      },
      {
        path: 'balcony/list',
        name: 'balcony-list',
        component: BalconyList,
        meta: {
          login: true
        }
      },
      {
        path: 'collect/list',
        name: 'collect-list',
        component: CollectList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'search/goods',
        name: 'search-goods',
        component: SearchGoods,
        meta: {
          login: true
        }
      },
      {
        path: 'search/friend',
        name: 'search-friend',
        component: SearchFriend,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'search/integral',
        name: 'search-integral',
        component: SearchIntegral,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'invited/member',
        name: 'invited-member',
        component: InvitedMember,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'invited/order/:id',
        name: 'invited-order',
        component: InvitedOrder,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'login/password',
        name: 'login-password',
        component: LoginPassword
      },
      {
        path: 'login/message',
        name: 'login-message',
        component: LoginMessage
      },
      {
        path: 'login/bind',
        name: 'login-bind',
        component: LoginBind
      },
      {
        path: 'account/index',
        name: 'account-index',
        component: AccountIndex
      },
      {
        path: 'account/report',
        name: 'account-report',
        component: AccountReport
      },
      {
        path: 'account/balance/charge',
        name: 'balance-charge',
        component: BalanceCharge
      },
      {
        path: 'account/balance/bill',
        name: 'balance-bill',
        component: BalanceBill
      },
      {
        path: 'account/balance/history',
        name: 'balance-history',
        component: BalanceHistory
      },
      {
        path: 'account/balance/success',
        name: 'balance-success',
        component: BalanceSuccess
      },
      {
        path: 'account/balance/error',
        name: 'balance-error',
        component: BalanceError
      },
      {
        path: 'account/integral/income',
        name: 'integral-income',
        component: IntegralIncome
      },
      {
        path: 'account/integral/other',
        name: 'integral-other',
        component: IntegralOther
      },
      {
        path: 'account/integral/history',
        name: 'integral-history',
        component: IntegralHistory
      },
      {
        path: 'account/integral/instruction',
        name: 'integral-instruction',
        component: IntegralInstruction
      },
      {
        path: 'account/withdraw',
        name: 'account-withdraw',
        component: AccountWithdraw
      },
      {
        path: 'integral/transfer',
        name: 'integral-transfer',
        component: IntegralTransfer
      },
      {
        path: 'member/friend',
        name: 'member-friend',
        component: MemberFriend
      },
      {
        path: 'bankcard/edit',
        name: 'bankcard-edit',
        component: BankcardEdit
      },
      {
        path: 'bankcard-list',
        name: 'bankcard-list',
        component: BankcardList
      },
      {
        path: 'order/payResultConfirm',
        name: 'order-pay-result-confirm',
        component: PayResultConfirm
      },
      {
        path: 'account/qrcodePay',
        name: 'account-qrcodePay',
        component: QrcodePay
      },
      {
        path: 'wallet/bind',
        name: 'wallet-bind',
        component: WalletBind
      },
      {
        path: 'wallet/transfer',
        name: 'wallet-transfer',
        component: WalletTransfer
      },
      {
        path: 'wallet/success',
        name: 'wallet-success',
        component: WalletSuccess
      },
      {
        path: 'setting/gzh',
        name: 'setting-gzh',
        component: Gzh
      },
      {
        path: 'setting/fwh',
        name: 'setting-fwh',
        component: Fwh
      },
      {
        path: 'setting/gzh-help',
        name: 'setting-gzh-help',
        component: GzhHelp
      },
      {
        path: 'setting/about',
        name: 'setting-about',
        component: About
      },
      {
        path: 'setting/download',
        name: 'setting-download',
        component: Download
      },
      {
        path: 'notice/alert',
        name: 'notice-alert',
        component: NoticeAlert
      },
      {
        path: 'member/tobeVip',
        name: 'member-tobeVip',
        component: MemberTobeVip,
        meta: {
          login: true
        }
      },
      {
        path: 'member/flowerCoinBill',
        name: 'member-flowerCoinBill',
        component: MemberFlowerCoinBill
      },
      {
        path: 'member/identifyAdd',
        name: 'member-identifyAdd',
        component: MemberIdentifyAdd,
        meta: {
          login: true
        }
      },
      {
        path: 'member/identifyInfo',
        name: 'member-identifyInfo',
        component: MemberIdentifyInfo,
        meta: {
          login: true
        }
      },
      {
        path: 'member/info',
        name: 'member-info',
        component: MemberInfo,
        meta: {
          login: true
        }
      },
      {
        path: 'account/tranfer',
        name: 'account-tranfer',
        component: Transfer,
        meta: {
          login: true
        }
      },
      {
        path: 'setting/setName',
        name: 'setting-setName',
        component: SetName,
        meta: {
          login: true
        }
      },
      {
        path: 'address/orderAddress',
        name: 'address-orderAddress',
        component: OrderAddress,
        meta: {
          login: true
        }
      },
      {
        path: 'member/nextSum',
        name: 'member-nextSum',
        component: NextSum,
        meta: {
          login: true
        }
      },
      {
        path: 'transfer/transaction',
        name: 'transfer-transaction',
        component: Transaction,
        meta: {
          login: true
        }
      },
      {
        path: 'transfer/transactionDetail',
        name: 'transfer-transactionDetail',
        component: TransactionDetail,
        meta: {
          login: true
        }
      },
      {
        path: 'transfer/transactionSeller',
        name: 'transfer-transactionSeller',
        component: TransactionSeller,
        meta: {
          login: true
        }
      },
      {
        path: 'account/reward',
        name: 'account-reward',
        component: AccountReward,
        meta: {
          login: true
        }
      },
      {
        path: 'setting/bankCard',
        name: 'setting-bankCard',
        component: SettingBankCard,
        meta: {
          login: true
        }
      },
      {
        path: 'goods/listGoods',
        name: 'goods-listGoods',
        component: ListGoods,
        meta: {
          login: true
        }
      },
      {
        path: 'category/categories',
        name: 'category-list',
        component: Categories,
        meta: {
          login: true
        }
      },
      {
        path: 'goods/listGoods2',
        name: 'goods-listGoods2',
        component: ListGoods2,
        meta: {
          login: true
        }
      }
    ]
  }
]

// 合并公共路由
// routers = routers.concat(commonRouter)

export {list, scrollBehavior}

